// src/mock/mockData/permissionsData.ts
import Mock from 'mockjs';
 
// 动态生成菜单数据
export default (data: any) => {
  // 解析传入的 data 参数
  const { username, password } = data;
 

  // 根据用户名和密码生成不同的响应
  if (username === 'admin') {
    return Mock.mock({
      status_code: 200,
      status: 'success',
      message: 'Operation successful.',
      data:  [
        { index: 'permissionsInfoOne', 
            label: '权限演示-1',
            path: 'views/SysSettings/UserInfo',
            permissions: [
                "demo1:view",
                "demo1:create",
                "demo1:edit",
                "demo1:delete"
            ]
    
         },
        { index: 'permissionsInfoTwo', 
            label: '权限演示-2',
            path: 'views/SysSettings/AccountSetting' ,
            permissions: [
                "demo2:view",
                "demo2:create",
                "demo2:edit",
                "demo2:delete"
            ]
    
        },

         
      ],
    });
  } else if (username === 'user' ) {
    return Mock.mock({
        status_code: 200,
        status: 'success',
        message: 'Operation successful.',
        data:  [
          { index: 'permissionsInfoOne', 
              label: '权限演示-1',
              path: 'views/Demos/permissionsInfoOne',
              permissions: [
                  "demo1:view",
                  "demo1:create",
                  "demo1:edit"                 
              ]
      
           },
          {   index: 'permissionsInfoTwo', 
              label: '权限演示-2',
              path: 'views/Demos/permissionsInfoTwo' ,
              permissions: [
                  "demo2:view",
                  "demo2:create",                 
                  "demo2:delete"
              ]
      
          },
          ,
          {   index: 'permissionsInfoThree', 
              label: '权限演示-2',
              path: 'views/Demos/permissionsInfoThree' ,
              permissions: [
                  "view",
                  "create",                 
                  "delete"
              ]
      
          },
  
           
        ],
      });
  } else {
    return Mock.mock({
      status_code: 401,
      status: 'fail',
      message: 'Invalid username ,No permissions Data.',
      data: [],
    });
  }
};